﻿using com.kmer.Attributes;
using System;

// ReSharper disable once CheckNamespace
namespace com.kmer.ApiServer
{
    /// <summary>
    /// Api访问日志
    /// </summary>
    public class ApiLog
    {
        /// <summary>
        /// 唯一ID
        /// 使用创建对象时的 DateTime.Now.Ticks
        /// </summary>
        public long ID { get; set; }
        /// <summary>
        /// IP 地址
        /// </summary>
        public string IpAddress { get; set; }
        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime BeginTime { get; set; }
        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime EndTime { get; set; }
        /// <summary>
        /// 控制器
        /// </summary>
        public string Controller { get; set; }
        /// <summary>
        /// 动作
        /// </summary>
        public string Action { get; set; }
        /// <summary>
        /// 输入的参数
        /// </summary>
        public string Params { get; set; }
        /// <summary>
        /// 用户ID（如果有）
        /// </summary>
        public int CusID { get; set; }
        /// <summary>
        /// 执行是否成功
        /// </summary>
        public bool IsSuccess { get; set; }
        /// <summary>
        /// 错误代码
        /// </summary>
        public int ErrorCode { get; set; }
        /// <summary>
        /// 信息（一般是错误信息）
        /// </summary>
        public string Message { get; set; }
        /// <summary>
        /// 调用API的app名称
        /// </summary>
        public string AppName { get; set; }
        /// <summary>
        /// 调用API的app的ID
        /// </summary>
        public Guid AppID { get; set; }

        const int ExpiryMonthInMinutes = 60 * 24 * 7;

    }

    /// <summary>
    /// 公司数据
    /// </summary>
    public class CompanyData
    {
        /// <summary>
        /// 公司编码
        /// </summary>
        [ParamDescription("公司编码")]
        public string CompanyID { get; set; }
        /// <summary>
        /// 公司名称
        /// </summary>
        [ParamDescription("公司名称")]
        public string DeptContent { get; set; }
    }
}
